package com.weiqiao.api.repository.impl;

import com.weiqiao.api.repository.IOrderApiRepository;
import com.weiqiao.base.dao.impl.BaseMongoDaoImpl;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author ChenYF
 * @Description
 * @Date 2020/7/28 19:10
 */
@Repository("OrderApiRepositoryImpl")
public class OrderApiRepositoryImpl extends BaseMongoDaoImpl implements IOrderApiRepository {

    private String collectionName = "orders_";

    @Override
    public boolean addOrder(int company_id, Document doc) {
        return this.inSertDocument(collectionName + company_id, doc);
    }

    @Override
    public List<String> getOrderListAndPage(int company_id, Document doc, Bson sort, int skep, int limit) {
        return this.findFilterSortSkipLimit(collectionName + company_id, doc, sort, skep, limit);
    }

    @Override
    public int countInfoNum(int company_id, Document doc) {
        return super.statististics(collectionName + company_id, doc);
    }

}
